<template>
  <div class="loader"></div>
  <h1 data-splitting>加载中...</h1>
</template>

<script setup lang="ts"></script>

<style lang="scss" scoped>
$animation-duration: 1.8s;
h1 {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 20px;
  color: var(--font-primary);
  font-weight: 500;
  letter-spacing: 5px;
  transform: translate(-50%, -50%);
}
.loader {
  position: absolute;
  top: 40%;
  left: 45%;
  transform: translate(-40%, -45%);
  width: 50px;
  height: 10px;
  background: #3498db;
  border-radius: 5px;
  animation: load $animation-duration ease-in-out infinite;
  &:before,
  &:after {
    position: absolute;
    display: block;
    content: "";
    animation: load $animation-duration ease-in-out infinite;
    height: 10px;
    border-radius: 5px;
  }
  &:before {
    top: -20px;
    left: 10px;
    width: 40px;
    background: #ef4836;
  }
  &:after {
    bottom: -20px;
    width: 35px;
    background: #f5ab35;
  }
}

@keyframes load {
  0% {
    transform: translateX(40px);
  }

  50% {
    transform: translateX(-30px);
  }
  100% {
    transform: translateX(40px);
  }
}
</style>
